// pages/index/searchbar/zhuanjia/zhuanjia.js
const app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    url:'',
    consultList: [],
    specialtyList: [],
    pageNum:1,
    pageSize:5,
  },
  onClickLeft(){
    wx.navigateBack();
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    wx.showLoading({
        title:'正在加载中...',
        icon:'loading',
        mask:true
      });
    this.setData({
    url: app.globalData.URL,
    isLoading:true
    })
    let that = this;
    wx.request({
    url: that.data.url + 'consultspecialty/selectByPage',
    data:{
        pageNum:that.data.pageNum,
        pageSize:30
    },
    method: 'GET',
    success(resp) {
        that.setData({
        specialtyList: [...that.data.specialtyList,...resp.data.data.list],
        pages:resp.data.data.pages,
        })
        console.log(that.data.specialtyList);
    },
    complete(){
        wx.hideLoading();
        wx.stopPullDownRefresh();
        that.setData({
        isLoading:false
        })
    }
    })
    wx.request({
    url: that.data.url + 'consult/findAll',
    data:{
        pageNum:that.data.pageNum,
        pageSize:8
    },
    method: 'GET',
    success(resp) {
        that.setData({
        consultList: [...that.data.consultList,...resp.data.data.list],
        pages:resp.data.data.pages,
        })
    },
    complete(){
        wx.hideLoading();
        wx.stopPullDownRefresh();
        that.setData({
        isLoading:false
        })
    }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})